# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.EssentialContacts.V1.Model.GoogleCloudEssentialcontactsV1Contact do
  @moduledoc """
  A contact that will receive notifications from Google Cloud.

  ## Attributes

  *   `email` (*type:* `String.t`, *default:* `nil`) - Required. The email address to send notifications to. The email address does not need to be a Google Account.
  *   `languageTag` (*type:* `String.t`, *default:* `nil`) - Required. The preferred language for notifications, as a ISO 639-1 language code. See [Supported languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages) for a list of supported languages.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. The identifier for the contact. Format: {resource_type}/{resource_id}/contacts/{contact_id}
  *   `notificationCategorySubscriptions` (*type:* `list(String.t)`, *default:* `nil`) - Required. The categories of notifications that the contact will receive communications for.
  *   `validateTime` (*type:* `DateTime.t`, *default:* `nil`) - The last time the validation_state was updated, either manually or automatically. A contact is considered stale if its validation state was updated more than 1 year ago.
  *   `validationState` (*type:* `String.t`, *default:* `nil`) - Output only. The validity of the contact. A contact is considered valid if it is the correct recipient for notifications for a particular resource.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :email => String.t() | nil,
          :languageTag => String.t() | nil,
          :name => String.t() | nil,
          :notificationCategorySubscriptions => list(String.t()) | nil,
          :validateTime => DateTime.t() | nil,
          :validationState => String.t() | nil
        }

  field(:email)
  field(:languageTag)
  field(:name)
  field(:notificationCategorySubscriptions, type: :list)
  field(:validateTime, as: DateTime)
  field(:validationState)
end

defimpl Poison.Decoder,
  for: GoogleApi.EssentialContacts.V1.Model.GoogleCloudEssentialcontactsV1Contact do
  def decode(value, options) do
    GoogleApi.EssentialContacts.V1.Model.GoogleCloudEssentialcontactsV1Contact.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.EssentialContacts.V1.Model.GoogleCloudEssentialcontactsV1Contact do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
